package com.test.work;

import java.util.concurrent.Callable;

/**
 * @author Cc
 * 2024-03-19
 */
public class CalcCallable implements Callable<Integer> {
    /*
        起始数
     */
    private int startNum;
    /*
        末尾数
     */
    private int endNum;

    public CalcCallable(int startNum, int endNum) {
        this.startNum = startNum;
        this.endNum = endNum;
    }

    @Override
    public Integer call() throws Exception {
        int totalNum = 0;
        for (int i = this.startNum; i <= this.endNum; i++) {
            totalNum += i;
        }

        return totalNum;
    }
}
